home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
ListBoxEditor.cpp
< prev
next >
Wrap
Text File
|
1997-08-11
|
4KB
|
152 lines
/*
* File: ListBoxEditor.cpp
* Summary: A view that knows how to edit a TListBox.
* Written by: Jesse Jones
*
* Copyright ゥ 1997 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 1/22/97 JDJ Created
*/
#include "ListBoxEditor.h"
#include <ZColorSwatch.h>
#include <ZControl.h>
// ===================================================================================
// class CEditListBoxCommand
// ===================================================================================
//---------------------------------------------------------------
//
// CEditListBoxCommand::~CEditListBoxCommand
//
//---------------------------------------------------------------
CEditListBoxCommand::~CEditListBoxCommand()
{
}
//---------------------------------------------------------------
//
// CEditListBoxCommand::CEditListBoxCommand
//
//---------------------------------------------------------------
CEditListBoxCommand::CEditListBoxCommand(TListBoxBase* pane, const SListBoxInfo& oldInfo, const SListBoxInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
{
}
//---------------------------------------------------------------
//
// CEditListBoxCommand::UpdatePane
//
//---------------------------------------------------------------
void CEditListBoxCommand::UpdatePane(const SListBoxInfo& inInfo)
{
SListBoxInfo info = inInfo;
mPane->SetInfo(info);
}
#pragma mark -
// ===================================================================================
// CListBoxEditor
// ===================================================================================
static TReanimatorRegister<CListBoxEditor> sListBoxEditorRegistrar;
//---------------------------------------------------------------
//
// CListBoxEditor::~CListBoxEditor
//
//---------------------------------------------------------------
CListBoxEditor::~CListBoxEditor()
{
}
//---------------------------------------------------------------
//
// CListBoxEditor::CListBoxEditor
//
//---------------------------------------------------------------
CListBoxEditor::CListBoxEditor(TView* superView) : Inherited(superView)
{
}
//---------------------------------------------------------------
//
// CListBoxEditor::Create [static]
//
//---------------------------------------------------------------
MReanimatable* CListBoxEditor::Create(MReanimatable* parent)
{
return new CListBoxEditor(dynamic_cast<TView*>(parent));
}
//---------------------------------------------------------------
//
// CListBoxEditor::GetEditorInfo
//
//---------------------------------------------------------------
SListBoxInfo CListBoxEditor::GetEditorInfo() const
{
SListBoxInfo info;
TControl* control = nil;
control = dynamic_cast<TControl*>(this->FindSubPane("Can Scroll"));
info.canScroll = control->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Allow Multiple Selections"));
info.allowMultipleSelections = control->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Draw Focus Box"));
info.drawFocusBox = control->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Draw Frame"));
info.framePixels = control->GetValue();
TColorSwatch* swatch = dynamic_cast<TColorSwatch*>(this->FindSubPane("Back Color"));
info.backColor = swatch->GetColor();
return info;
}
//---------------------------------------------------------------
//
// CListBoxEditor::SetEditorInfo
//
//---------------------------------------------------------------
void CListBoxEditor::SetEditorInfo(const SListBoxInfo& info)
{
TControl* control = nil;
control = dynamic_cast<TControl*>(this->FindSubPane("Can Scroll"));
control->SetValue(info.canScroll);
control = dynamic_cast<TControl*>(this->FindSubPane("Allow Multiple Selections"));
control->SetValue(info.allowMultipleSelections);
control = dynamic_cast<TControl*>(this->FindSubPane("Draw Focus Box"));
control->SetValue(info.drawFocusBox);
control = dynamic_cast<TControl*>(this->FindSubPane("Draw Frame"));
control->SetValue(info.framePixels > 0);
TColorSwatch* swatch = dynamic_cast<TColorSwatch*>(this->FindSubPane("Back Color"));
swatch->SetColor(info.backColor);
}